/*
 Navicat Premium Data Transfer

 Source Server         : MBTI_DEMO
 Source Server Type    : PostgreSQL
 Source Server Version : 120006
 Source Host           : 124.220.200.126:5432
 Source Catalog        : MBTI_SYSTEM
 Source Schema         : public

 Target Server Type    : PostgreSQL
 Target Server Version : 120006
 File Encoding         : 65001

 Date: 15/06/2022 18:31:49
*/


-- ----------------------------
-- Table structure for classes
-- ----------------------------
DROP TABLE IF EXISTS "public"."classes";
CREATE TABLE "public"."classes" (
  "class_name" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "major_name" varchar(255) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Records of classes
-- ----------------------------
INSERT INTO "public"."classes" VALUES ('网络201', '网路工程');
INSERT INTO "public"."classes" VALUES ('软件201', '软件工程');
INSERT INTO "public"."classes" VALUES ('人工201', '人工智能');
INSERT INTO "public"."classes" VALUES ('计科201', '计算机科学与技术');
INSERT INTO "public"."classes" VALUES ('自动201', '自动化');
INSERT INTO "public"."classes" VALUES ('测控201', '测控技术与仪器');
INSERT INTO "public"."classes" VALUES ('车辆201', '车辆工程');
INSERT INTO "public"."classes" VALUES ('机器人201', '机器人工程');
INSERT INTO "public"."classes" VALUES ('机械201', '机械设计制造及其自动化');
INSERT INTO "public"."classes" VALUES ('智能201', '智能制造工程');
INSERT INTO "public"."classes" VALUES ('新闻201', '新闻学');
INSERT INTO "public"."classes" VALUES ('法学201', '法学');
INSERT INTO "public"."classes" VALUES ('汉语201', '汉语国际教育');
INSERT INTO "public"."classes" VALUES ('汉语言201', '汉语言文学');
INSERT INTO "public"."classes" VALUES ('制药201', '制药工程');
INSERT INTO "public"."classes" VALUES ('化学201', '应用化学');
INSERT INTO "public"."classes" VALUES ('生物201', '生物工程');
INSERT INTO "public"."classes" VALUES ('化工201', '化学工程与工艺');
INSERT INTO "public"."classes" VALUES ('食品质量201', '食品质量与安全');
INSERT INTO "public"."classes" VALUES ('食品科学201', '食品科学与工程');
INSERT INTO "public"."classes" VALUES ('信息201', '信息与计算科学');
INSERT INTO "public"."classes" VALUES ('统计201', '统计学');
INSERT INTO "public"."classes" VALUES ('区块链201', '区块链工程');
INSERT INTO "public"."classes" VALUES ('数学201', '数学与应用数学');
INSERT INTO "public"."classes" VALUES ('行政201', '行政管理');
INSERT INTO "public"."classes" VALUES ('市营201', '市场营销');
INSERT INTO "public"."classes" VALUES ('人力201', '人力资源管理');
INSERT INTO "public"."classes" VALUES ('工商201', '工商管理');
INSERT INTO "public"."classes" VALUES ('航管201', '航空服务艺术与管理');
INSERT INTO "public"."classes" VALUES ('经济201', '经济学');
INSERT INTO "public"."classes" VALUES ('旅馆201', '旅游管理');
INSERT INTO "public"."classes" VALUES ('物联201', '物联网工程');
INSERT INTO "public"."classes" VALUES ('通信201', '通信工程');
INSERT INTO "public"."classes" VALUES ('电子201', '电子信息工程');
INSERT INTO "public"."classes" VALUES ('英语201', '英语');
INSERT INTO "public"."classes" VALUES ('朝鲜201', '朝鲜语');
INSERT INTO "public"."classes" VALUES ('日语201', '日语');
INSERT INTO "public"."classes" VALUES ('土木201', '土木工程');
INSERT INTO "public"."classes" VALUES ('工管201', '工程管理');
INSERT INTO "public"."classes" VALUES ('建环201', '建筑环境与能源应用');
INSERT INTO "public"."classes" VALUES ('环设201', '环境设计');
INSERT INTO "public"."classes" VALUES ('建筑201', '建筑学');
INSERT INTO "public"."classes" VALUES ('城乡201', '城乡规划');
INSERT INTO "public"."classes" VALUES ('产品201', '产品设计');
INSERT INTO "public"."classes" VALUES ('视传201', '视觉传达设计');
INSERT INTO "public"."classes" VALUES ('动画201', '动画');
INSERT INTO "public"."classes" VALUES ('工设201', '工业设计');
INSERT INTO "public"."classes" VALUES ('财管201', '财务管理');
INSERT INTO "public"."classes" VALUES ('国贸201', '国际经济与贸易');
INSERT INTO "public"."classes" VALUES ('国商201', '国际商务');
INSERT INTO "public"."classes" VALUES ('会计201', '会计学');
INSERT INTO "public"."classes" VALUES ('生技201', '生物技术');
INSERT INTO "public"."classes" VALUES ('环工201', '环境工程');
INSERT INTO "public"."classes" VALUES ('环科201', '环境科学');
INSERT INTO "public"."classes" VALUES ('预科201', '少数民族预科');
INSERT INTO "public"."classes" VALUES ('功材201', '功能材料');
INSERT INTO "public"."classes" VALUES ('光电201', '光电信息科学与工程');

-- ----------------------------
-- Table structure for colleges
-- ----------------------------
DROP TABLE IF EXISTS "public"."colleges";
CREATE TABLE "public"."colleges" (
  "college_name" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "grade" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "coid" varchar(255) COLLATE "pg_catalog"."default" NOT NULL
)
;

-- ----------------------------
-- Records of colleges
-- ----------------------------
INSERT INTO "public"."colleges" VALUES ('计算机科学与工程', '2021', '1');
INSERT INTO "public"."colleges" VALUES ('计算机科学与工程', '2020', '2');
INSERT INTO "public"."colleges" VALUES ('计算机科学与工程', '2019', '3');
INSERT INTO "public"."colleges" VALUES ('计算机科学与工程', '2018', '4');
INSERT INTO "public"."colleges" VALUES ('机电工程', '2021', '5');
INSERT INTO "public"."colleges" VALUES ('机电工程', '2020', '6');
INSERT INTO "public"."colleges" VALUES ('机电工程', '2019', '7');
INSERT INTO "public"."colleges" VALUES ('机电工程', '2018', '8');
INSERT INTO "public"."colleges" VALUES ('文法学院', '2021', '9');
INSERT INTO "public"."colleges" VALUES ('文法学院', '2019', '11');
INSERT INTO "public"."colleges" VALUES ('文法学院', '2020', '10');
INSERT INTO "public"."colleges" VALUES ('文法学院', '2018', '12');
INSERT INTO "public"."colleges" VALUES ('生命科学', '2021', '13');
INSERT INTO "public"."colleges" VALUES ('生命科学', '2020', '14');
INSERT INTO "public"."colleges" VALUES ('生命科学', '2019', '15');
INSERT INTO "public"."colleges" VALUES ('生命科学', '2018', '16');
INSERT INTO "public"."colleges" VALUES ('理学院', '2021', '17');
INSERT INTO "public"."colleges" VALUES ('理学院', '2020', '18');
INSERT INTO "public"."colleges" VALUES ('理学院', '2019', '19');
INSERT INTO "public"."colleges" VALUES ('理学院', '2018', '20');
INSERT INTO "public"."colleges" VALUES ('经济管理', '2021', '21');
INSERT INTO "public"."colleges" VALUES ('经济管理', '2020', '22');
INSERT INTO "public"."colleges" VALUES ('经济管理', '2019', '23');
INSERT INTO "public"."colleges" VALUES ('经济管理', '2018', '24');
INSERT INTO "public"."colleges" VALUES ('信息与通信工程', '2021', '25');
INSERT INTO "public"."colleges" VALUES ('信息与通信工程', '2020', '26');
INSERT INTO "public"."colleges" VALUES ('信息与通信工程', '2019', '27');
INSERT INTO "public"."colleges" VALUES ('信息与通信工程', '2018', '28');
INSERT INTO "public"."colleges" VALUES ('外国语', '2021', '29');
INSERT INTO "public"."colleges" VALUES ('外国语', '2020', '30');
INSERT INTO "public"."colleges" VALUES ('外国语', '2019', '31');
INSERT INTO "public"."colleges" VALUES ('外国语', '2018', '32');
INSERT INTO "public"."colleges" VALUES ('土木工程', '2021', '33');
INSERT INTO "public"."colleges" VALUES ('土木工程', '2020', '34');
INSERT INTO "public"."colleges" VALUES ('土木工程', '2019', '35');
INSERT INTO "public"."colleges" VALUES ('土木工程', '2018', '36');
INSERT INTO "public"."colleges" VALUES ('建筑', '2021', '37');
INSERT INTO "public"."colleges" VALUES ('建筑', '2020', '38');
INSERT INTO "public"."colleges" VALUES ('建筑', '2019', '39');
INSERT INTO "public"."colleges" VALUES ('建筑', '2018', '40');
INSERT INTO "public"."colleges" VALUES ('设计', '2021', '41');
INSERT INTO "public"."colleges" VALUES ('设计', '2020', '42');
INSERT INTO "public"."colleges" VALUES ('设计', '2019', '43');
INSERT INTO "public"."colleges" VALUES ('设计', '2018', '44');
INSERT INTO "public"."colleges" VALUES ('国际商', '2021', '45');
INSERT INTO "public"."colleges" VALUES ('国际商', '2020', '46');
INSERT INTO "public"."colleges" VALUES ('国际商', '2019', '47');
INSERT INTO "public"."colleges" VALUES ('国际商', '2018', '48');
INSERT INTO "public"."colleges" VALUES ('环境与资源', '2021', '49');
INSERT INTO "public"."colleges" VALUES ('环境与资源', '2020', '50');
INSERT INTO "public"."colleges" VALUES ('环境与资源', '2019', '51');
INSERT INTO "public"."colleges" VALUES ('环境与资源', '2018', '52');
INSERT INTO "public"."colleges" VALUES ('预科教育', '2021', '53');
INSERT INTO "public"."colleges" VALUES ('预科教育', '2020', '54');
INSERT INTO "public"."colleges" VALUES ('预科教育', '2019', '55');
INSERT INTO "public"."colleges" VALUES ('预科教育', '2018', '56');
INSERT INTO "public"."colleges" VALUES ('物理与材料', '2021', '57');
INSERT INTO "public"."colleges" VALUES ('物理与材料', '2020', '58');
INSERT INTO "public"."colleges" VALUES ('物理与材料', '2019', '59');
INSERT INTO "public"."colleges" VALUES ('物理与材料', '2018', '60');

-- ----------------------------
-- Table structure for grades
-- ----------------------------
DROP TABLE IF EXISTS "public"."grades";
CREATE TABLE "public"."grades" (
  "grade" varchar COLLATE "pg_catalog"."default" NOT NULL
)
;

-- ----------------------------
-- Records of grades
-- ----------------------------
INSERT INTO "public"."grades" VALUES ('2021');
INSERT INTO "public"."grades" VALUES ('2020');
INSERT INTO "public"."grades" VALUES ('2019');
INSERT INTO "public"."grades" VALUES ('2018');

-- ----------------------------
-- Table structure for majors
-- ----------------------------
DROP TABLE IF EXISTS "public"."majors";
CREATE TABLE "public"."majors" (
  "major_name" varchar COLLATE "pg_catalog"."default" NOT NULL,
  "college_name" varchar COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Records of majors
-- ----------------------------
INSERT INTO "public"."majors" VALUES ('网路工程', '计算机科学与工程');
INSERT INTO "public"."majors" VALUES ('软件工程', '计算机科学与工程');
INSERT INTO "public"."majors" VALUES ('人工智能', '计算机科学与工程');
INSERT INTO "public"."majors" VALUES ('计算机科学与技术', '计算机科学与工程');
INSERT INTO "public"."majors" VALUES ('自动化', '机电工程');
INSERT INTO "public"."majors" VALUES ('测控技术与仪器', '机电工程');
INSERT INTO "public"."majors" VALUES ('车辆工程', '机电工程');
INSERT INTO "public"."majors" VALUES ('机器人工程', '机电工程');
INSERT INTO "public"."majors" VALUES ('机械设计制造及其自动化', '机电工程');
INSERT INTO "public"."majors" VALUES ('智能制造工程', '机电工程');
INSERT INTO "public"."majors" VALUES ('新闻学', '文法学院');
INSERT INTO "public"."majors" VALUES ('法学', '文法学院');
INSERT INTO "public"."majors" VALUES ('汉语国际教育', '文法学院');
INSERT INTO "public"."majors" VALUES ('汉语言文学', '文法学院');
INSERT INTO "public"."majors" VALUES ('制药工程', '生命科学');
INSERT INTO "public"."majors" VALUES ('应用化学', '生命科学');
INSERT INTO "public"."majors" VALUES ('生物工程', '生命科学');
INSERT INTO "public"."majors" VALUES ('化学工程与工艺', '生命科学');
INSERT INTO "public"."majors" VALUES ('食品质量与安全', '生命科学');
INSERT INTO "public"."majors" VALUES ('食品科学与工程', '生命科学');
INSERT INTO "public"."majors" VALUES ('信息与计算科学', '理学院');
INSERT INTO "public"."majors" VALUES ('统计学', '理学院');
INSERT INTO "public"."majors" VALUES ('区块链工程', '理学院');
INSERT INTO "public"."majors" VALUES ('数学与应用数学', '理学院');
INSERT INTO "public"."majors" VALUES ('行政管理', '经济管理');
INSERT INTO "public"."majors" VALUES ('市场营销', '经济管理');
INSERT INTO "public"."majors" VALUES ('人力资源管理', '经济管理');
INSERT INTO "public"."majors" VALUES ('工商管理', '经济管理');
INSERT INTO "public"."majors" VALUES ('航空服务艺术与管理', '经济管理');
INSERT INTO "public"."majors" VALUES ('经济学', '经济管理');
INSERT INTO "public"."majors" VALUES ('旅游管理', '经济管理');
INSERT INTO "public"."majors" VALUES ('物联网工程', '信息与通信工程');
INSERT INTO "public"."majors" VALUES ('通信工程', '信息与通信工程');
INSERT INTO "public"."majors" VALUES ('电子信息工程', '信息与通信工程');
INSERT INTO "public"."majors" VALUES ('英语', '外国语');
INSERT INTO "public"."majors" VALUES ('朝鲜语', '外国语');
INSERT INTO "public"."majors" VALUES ('日语', '外国语');
INSERT INTO "public"."majors" VALUES ('土木工程', '土木工程');
INSERT INTO "public"."majors" VALUES ('工程管理', '土木工程');
INSERT INTO "public"."majors" VALUES ('建筑环境与能源应用', '土木工程');
INSERT INTO "public"."majors" VALUES ('环境设计', '建筑');
INSERT INTO "public"."majors" VALUES ('建筑学', '建筑');
INSERT INTO "public"."majors" VALUES ('城乡规划', '建筑');
INSERT INTO "public"."majors" VALUES ('产品设计', '设计');
INSERT INTO "public"."majors" VALUES ('视觉传达设计', '设计');
INSERT INTO "public"."majors" VALUES ('动画', '设计');
INSERT INTO "public"."majors" VALUES ('工业设计', '设计');
INSERT INTO "public"."majors" VALUES ('财务管理', '国际商');
INSERT INTO "public"."majors" VALUES ('国际经济与贸易', '国际商');
INSERT INTO "public"."majors" VALUES ('国际商务', '国际商');
INSERT INTO "public"."majors" VALUES ('会计学', '国际商');
INSERT INTO "public"."majors" VALUES ('生物技术', '环境与资源');
INSERT INTO "public"."majors" VALUES ('环境工程', '环境与资源');
INSERT INTO "public"."majors" VALUES ('环境科学', '环境与资源');
INSERT INTO "public"."majors" VALUES ('少数民族预科', '预科教育');
INSERT INTO "public"."majors" VALUES ('功能材料', '物理与材料工程');
INSERT INTO "public"."majors" VALUES ('光电信息科学与工程', '物理与材料工程');

-- ----------------------------
-- Table structure for personalities
-- ----------------------------
DROP TABLE IF EXISTS "public"."personalities";
CREATE TABLE "public"."personalities" (
  "PersonalityName" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "Alias" varchar(255) COLLATE "pg_catalog"."default" NOT NULL
)
;

-- ----------------------------
-- Records of personalities
-- ----------------------------
INSERT INTO "public"."personalities" VALUES ('INTP', '逻辑学家');
INSERT INTO "public"."personalities" VALUES ('INTJ', '建筑师');
INSERT INTO "public"."personalities" VALUES ('ENTP', '辩论家');
INSERT INTO "public"."personalities" VALUES ('ENTJ', '指挥官');
INSERT INTO "public"."personalities" VALUES ('ENFJ', '主人公');
INSERT INTO "public"."personalities" VALUES ('INFJ', '提倡者');
INSERT INTO "public"."personalities" VALUES ('INFP', '调停者');
INSERT INTO "public"."personalities" VALUES ('ENFP', '竞选者');
INSERT INTO "public"."personalities" VALUES ('ESFP', '表演者');
INSERT INTO "public"."personalities" VALUES ('ISFP', '探险家');
INSERT INTO "public"."personalities" VALUES ('ISTP', '鉴赏家');
INSERT INTO "public"."personalities" VALUES ('ESTP', '企业家');
INSERT INTO "public"."personalities" VALUES ('ISFJ', '守卫者');
INSERT INTO "public"."personalities" VALUES ('ESFJ', '执政官');
INSERT INTO "public"."personalities" VALUES ('ESTJ', '总经理');
INSERT INTO "public"."personalities" VALUES ('ISTJ', '物流师');

-- ----------------------------
-- Table structure for questions
-- ----------------------------
DROP TABLE IF EXISTS "public"."questions";
CREATE TABLE "public"."questions" (
  "num" int4 NOT NULL,
  "question" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "module" varchar(255) COLLATE "pg_catalog"."default",
  "optiona" varchar(255) COLLATE "pg_catalog"."default",
  "optionb" varchar(255) COLLATE "pg_catalog"."default",
  "amean" varchar(255) COLLATE "pg_catalog"."default",
  "bmean" varchar(255) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Records of questions
-- ----------------------------
INSERT INTO "public"."questions" VALUES (5, '一般来说，你和哪些人比较合得来？', '1', 'A富于想象力的人', 'B现实的人', 'N', 'S');
INSERT INTO "public"."questions" VALUES (6, '你是否经常让', '1', 'A你的情感支配你的理智', 'B你的理智主宰你的情感', 'F', 'T');
INSERT INTO "public"."questions" VALUES (7, '处理许多事情上，你会喜欢', '1', 'A凭兴所至行事', 'B按照计划行事', 'P', 'J');
INSERT INTO "public"."questions" VALUES (8, '你是否', '1', 'A容易让人了解', 'B难于让人了解', 'E', 'I');
INSERT INTO "public"."questions" VALUES (9, '按照程序表做事， ', '1', ' A合你心意', 'B令你感到束缚', 'J', 'P');
INSERT INTO "public"."questions" VALUES (10, '当你有一份特别的任务，你会喜欢', '1', 'A开始前小心组织计划', 'B边做边找须做什么', 'J', 'P');
INSERT INTO "public"."questions" VALUES (15, '你会跟哪些人做朋友？', '1', 'A常提出新注意的', 'B脚踏实地的', 'N', 'S');
INSERT INTO "public"."questions" VALUES (11, '在大多数情况下，你会选择', '1', 'A顺其自然', 'B按程序表做事', 'P', 'J');
INSERT INTO "public"."questions" VALUES (12, '大多数人会说你是一个', '1', 'A重视自我隐私的人', 'B非常坦率开放的人', 'I', 'E');
INSERT INTO "public"."questions" VALUES (13, '你宁愿被人认为是一个', '1', 'A实事求是的人', 'B机灵的人', 'S', 'N');
INSERT INTO "public"."questions" VALUES (16, '你倾向', '1', 'A重视感情多于逻辑', 'B重视逻辑多于感情', 'F', 'T');
INSERT INTO "public"."questions" VALUES (18, '你喜欢花很多的时间', '1', 'A一个人独处', 'B合别人在一起', 'I', 'E');
INSERT INTO "public"."questions" VALUES (19, '与很多人一起会', '1', 'A令你活力培增', 'B常常令你心力憔悴', 'E', 'I');
INSERT INTO "public"."questions" VALUES (21, '计划一个旅程时，你较喜欢', '1', 'A大部分的时间都是跟当天的感觉行事', 'B事先知道大部分的日子会做什么', 'P', 'J');
INSERT INTO "public"."questions" VALUES (22, '在社交聚会中，你', '1', 'A有时感到郁闷', 'B常常乐在其中', 'I', 'E');
INSERT INTO "public"."questions" VALUES (23, '你通常', '1', ' A和别人容易混熟', 'B趋向自处一隅', 'E', 'I');
INSERT INTO "public"."questions" VALUES (25, '在日常工作中，你会 ', '1', 'A颇为喜欢处理迫使你分秒必争的突发', 'B通常预先计划，以免要在压力下工作', 'P', 'J');
INSERT INTO "public"."questions" VALUES (27, '注重隐私   OR  坦率开放', '2', 'A注重隐私', 'B坦率开放', 'I', 'E');
INSERT INTO "public"."questions" VALUES (28, '预先安排的 OR 无计划的', '2', 'A预先安排的', 'B无计划的', 'J', 'P');
INSERT INTO "public"."questions" VALUES (29, '抽象    OR    具体', '2', 'A抽象', 'B具体', 'N', 'S');
INSERT INTO "public"."questions" VALUES (30, '温柔   OR     坚定', '2', 'A温柔        ', 'B坚定', 'F', 'T');
INSERT INTO "public"."questions" VALUES (31, '思考    OR    感受', '2', 'A思考', 'B感受', 'T', 'F');
INSERT INTO "public"."questions" VALUES (32, '事实   OR     意念', '2', 'A事实', 'B意念', 'S', 'N');
INSERT INTO "public"."questions" VALUES (33, '冲动    OR    决定', '2', 'A冲动        ', 'B决定', 'P', 'J');
INSERT INTO "public"."questions" VALUES (34, '热衷    OR    文静', '2', 'A热衷 ', 'B文静', 'E', 'I');
INSERT INTO "public"."questions" VALUES (35, '文静   OR     外向', '2', 'A文静 ', 'B外向', 'I', 'E');
INSERT INTO "public"."questions" VALUES (36, '有系统  OR    随意', '2', 'A有系统', 'B随意', 'J', 'P');
INSERT INTO "public"."questions" VALUES (38, '敏感   OR     公正', '2', 'A敏感        ', 'B公正', 'F', 'T');
INSERT INTO "public"."questions" VALUES (40, '声明    OR    概念', '2', 'A声明        ', 'B概念', 'S', 'N');
INSERT INTO "public"."questions" VALUES (41, '不受约束  OR  预先安排', '2', 'A不受约束 ', 'B预先安排', 'P', 'J');
INSERT INTO "public"."questions" VALUES (42, '矜持    OR    健谈', '2', 'A矜持        ', 'B健谈', 'I', 'E');
INSERT INTO "public"."questions" VALUES (44, '意念   OR    实况', '2', 'A意念 ', 'B实况', 'N', 'S');
INSERT INTO "public"."questions" VALUES (45, '同情怜悯  OR  远见', '2', 'A同情怜悯', 'B远见', 'F', 'T');
INSERT INTO "public"."questions" VALUES (47, '务实的  OR   理论的', '2', 'A务实的', 'B理论的', 'S', 'N');
INSERT INTO "public"."questions" VALUES (48, '朋友不多  OR   朋友众多', '2', 'A朋友不多     ', 'B朋友众多', 'I', 'E');
INSERT INTO "public"."questions" VALUES (50, '富想象的  OR   以事论事', '2', 'A富想象的 ', 'B以事论事', 'N', 'S');
INSERT INTO "public"."questions" VALUES (51, '亲切的   OR    客观的', '2', 'A亲切的', 'B客观的', 'F', 'T');
INSERT INTO "public"."questions" VALUES (53, '建造     OR    发明', '2', 'A建造  ', 'B发明', 'S', 'N');
INSERT INTO "public"."questions" VALUES (54, '文静    OR     爱合群', '2', 'A文静         ', 'B爱合群', 'I', 'E');
INSERT INTO "public"."questions" VALUES (55, '理论     OR    事实', '2', 'A理论', 'B事实', 'N', 'S');
INSERT INTO "public"."questions" VALUES (57, '具分析力   OR  多愁善感', '2', 'A具分析力     ', ' B多愁善感', 'T', 'F');
INSERT INTO "public"."questions" VALUES (60, '在社交场合中，你经常会感到', '3', 'A.与某些人很难打开话匣儿和保持对话', 'B.与多数人都能从容地长谈', 'I', 'E');
INSERT INTO "public"."questions" VALUES (61, '要做许多人也做的事，你比较喜欢', '3', 'A.按照一般认可的方法去做', 'B.构想一个自己的想法', 'S', 'N');
INSERT INTO "public"."questions" VALUES (63, '你通常较喜欢的科目是', '3', 'A.讲授概念和原则的', 'B.讲授事实和数据的', 'N', 'S');
INSERT INTO "public"."questions" VALUES (64, '哪个是较高的赞誉，或称许为？', '3', 'A.一贯感性的人', 'B.一贯理性的人', 'F', 'T');
INSERT INTO "public"."questions" VALUES (66, '和一群人在一起，你通常会选', '3', 'A.跟你很熟悉的个别人谈话', 'B.参与大伙的谈话', 'I', 'E');
INSERT INTO "public"."questions" VALUES (67, '在社交聚会上，你会', '3', 'A.是说话很多的一个', 'B.让别人多说话', 'E', 'I');
INSERT INTO "public"."questions" VALUES (68, '把周末期间要完成的事列成清单，这个主意会', '3', 'A.合你意', 'B.使你提不起劲', 'J', 'P');
INSERT INTO "public"."questions" VALUES (69, '哪个是较高的赞誉，或称许为', '3', 'A.能干的', 'B.富有同情心', 'T', 'F');
INSERT INTO "public"."questions" VALUES (70, '你通常喜欢', '3', 'A.事先安排你的社交约会', 'B.随兴之所至做事', 'J', 'P');
INSERT INTO "public"."questions" VALUES (72, '你能否滔滔不绝地与人聊天', '3', 'A.只限于跟你有共同兴趣的人', 'B.几乎跟任何人都可以', 'I', 'E');
INSERT INTO "public"."questions" VALUES (74, '为乐趣而阅读时，你会', '3', 'A.喜欢奇特或创新的表达方式', 'B.喜欢作者直话直说', 'N', 'S');
INSERT INTO "public"."questions" VALUES (75, '你宁愿替哪一类上司（或者老师）工作？', '3', 'A天性淳良，但常常前后不一的', 'B言词尖锐但永远合乎逻辑的', 'N', 'T');
INSERT INTO "public"."questions" VALUES (76, '你做事多数是', '3', 'A按当天心情去做', 'B照拟好的程序表去做', 'J', 'P');
INSERT INTO "public"."questions" VALUES (78, '要作决定时，你认为比较重要的是', '3', 'A据事实衡量', 'B考虑他人的感受和意见', 'T', 'F');
INSERT INTO "public"."questions" VALUES (79, '想象的 OR  真实的', '4', 'A想象的', 'B真实的', 'N', 'S');
INSERT INTO "public"."questions" VALUES (4, '你通常', '1', '  A与人容易混熟', 'B比较沉静或矜持', 'E', 'I');
INSERT INTO "public"."questions" VALUES (1, '当你要外出一整天，你会', '1', 'A 计划你要做什么和在什么时候做', 'B 说去就去', 'J', 'P');
INSERT INTO "public"."questions" VALUES (2, '你认为自己是一个', '1', 'A 较为随兴所至的人', 'B 较为有条理的人', 'P', 'J');
INSERT INTO "public"."questions" VALUES (3, '假如你是一位老师，你会选教', '1', 'A以事实为主的课程', 'B涉及理论的课程', 'S', 'N');
INSERT INTO "public"."questions" VALUES (14, '在一大群人当中，通常是', '1', 'A你介绍大家认识', 'B别人介绍你', 'E', 'I');
INSERT INTO "public"."questions" VALUES (17, '你比较喜欢', '1', ' A坐观事情发展才作计划', 'B很早就作计划', 'P', 'J');
INSERT INTO "public"."questions" VALUES (20, '你比较喜欢', '1', 'A很早便把约会、社交聚集等事情安排妥当', 'B无拘无束，看当时有什么好玩就做什么', 'J', 'P');
INSERT INTO "public"."questions" VALUES (87, '新颖的  OR   已知的', '4', 'A新颖的', 'B已知的', 'N', 'S');
INSERT INTO "public"."questions" VALUES (24, '哪些人会更吸引你？', '1', 'A 一个思想敏捷及非常聪颖的人', 'B实事求是，具丰富常识的人', 'N', 'S');
INSERT INTO "public"."questions" VALUES (26, '你认为别人一般', '1', 'A要花很长时间才认识你', 'B用很短的时间便认识你', 'I', 'E');
INSERT INTO "public"."questions" VALUES (37, '理论   OR     肯定', '2', 'A理论        ', 'B肯定', 'N', 'S');
INSERT INTO "public"."questions" VALUES (39, '令人信服  OR  感人的', '2', 'A令人信服', 'B感人的', 'T', 'F');
INSERT INTO "public"."questions" VALUES (43, '有条不紊  OR   不拘小节', '2', 'A有条不紊    ', 'B不拘小节', 'J', 'P');
INSERT INTO "public"."questions" VALUES (46, '利益   OR    祝福', '2', 'A利益        ', 'B祝福', 'T', 'F');
INSERT INTO "public"."questions" VALUES (49, '有系统   OR    即兴', '2', 'A有系统', 'B即兴', 'J', 'P');
INSERT INTO "public"."questions" VALUES (52, '客观的  OR    热情的', '2', 'A客观的', 'B热情的', 'T', 'F');
INSERT INTO "public"."questions" VALUES (56, '富同情   OR    合逻辑', '2', 'A富同情  ', 'B合逻辑', 'F', 'T');
INSERT INTO "public"."questions" VALUES (58, '合情合理  OR   令人着迷', '2', 'A合情合理', 'B令人着迷', 'S', 'N');
INSERT INTO "public"."questions" VALUES (59, '当你要在一个星期内完成一个大项目，你在开始的时候会 ', '3', 'A.把要做的不同工作依次列出', 'B.马上动工', 'J', 'P');
INSERT INTO "public"."questions" VALUES (62, '你刚认识的朋友能否说出你的兴趣？', '3', 'A.马上可以', 'B.要待他们真正了解你之后才可以', 'E', 'I');
INSERT INTO "public"."questions" VALUES (65, '你认为按照程序表做事', '3', 'A.有时是需要的，但一般来说你不大喜欢这样做', 'B.大多数情况下是有帮助而且是你喜欢做的', 'P', 'J');
INSERT INTO "public"."questions" VALUES (71, '总的说来，要做一个大型作业时，你会选', '3', 'A.边做边想该做什么', 'B.首先把工作按步细分', 'P', 'J');
INSERT INTO "public"."questions" VALUES (73, '你会', '3', 'A.跟随一些证明有效的方法', 'B.分析还有什么毛病，及针对尚未解决的难题', 'S', 'N');
INSERT INTO "public"."questions" VALUES (77, '你是否', '3', 'A可以和任何人按需求从容地交谈', 'B只是对某些人或在某种情况下才可以畅所欲言', 'E', 'I');
INSERT INTO "public"."questions" VALUES (80, '仁慈慷慨的  OR  意志坚定的', '4', 'A仁慈慷慨的', 'B意志坚定的', 'F', 'T');
INSERT INTO "public"."questions" VALUES (81, '公正的 OR 有关怀心', '4', 'A公正的', 'B有关怀心', 'T', 'F');
INSERT INTO "public"."questions" VALUES (82, '制作  OR  设计', '4', 'A制作', 'B设计', 'S', 'N');
INSERT INTO "public"."questions" VALUES (83, '可能性 OR  必然性', '4', 'A可能性', 'B必然性', 'N', 'S');
INSERT INTO "public"."questions" VALUES (84, '温柔  OR  力量', '4', 'A温柔', 'B力量', 'F', 'T');
INSERT INTO "public"."questions" VALUES (85, '实际  OR  多愁善感', '4', 'A实际', 'B多愁善感', 'T', 'F');
INSERT INTO "public"."questions" VALUES (86, '制造  OR  创造', '4', 'A制造', 'B创造', 'S', 'N');
INSERT INTO "public"."questions" VALUES (88, '同情 OR  分析', '4', 'A同情', 'B分析', 'F', 'T');
INSERT INTO "public"."questions" VALUES (89, '坚持己见  OR  温柔有爱心', '4', 'A坚持己见', 'B温柔有爱心', 'T', 'F');
INSERT INTO "public"."questions" VALUES (90, '具体的  OR  抽象的', '4', 'A具体的', 'B抽象的', 'S', 'N');
INSERT INTO "public"."questions" VALUES (91, '全心投入  OR  有决心的', '4', 'A全心投入', 'B有决心的', 'F', 'T');
INSERT INTO "public"."questions" VALUES (92, '能干   OR   仁慈', '4', 'A能干 ', 'B仁慈', 'T', 'F');
INSERT INTO "public"."questions" VALUES (93, '实际  OR  创新 ', '4', 'A实际', 'B创新 ', 'S', 'N');

-- ----------------------------
-- Table structure for students
-- ----------------------------
DROP TABLE IF EXISTS "public"."students";
CREATE TABLE "public"."students" (
  "s_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "sname" varchar(255) COLLATE "pg_catalog"."default",
  "ssex" varchar(255) COLLATE "pg_catalog"."default",
  "s_password" varchar(255) COLLATE "pg_catalog"."default",
  "major_name" varchar(255) COLLATE "pg_catalog"."default",
  "college_name" varchar(255) COLLATE "pg_catalog"."default",
  "grade" varchar(255) COLLATE "pg_catalog"."default",
  "stype" varchar(255) COLLATE "pg_catalog"."default" NOT NULL DEFAULT 1,
  "class_name" varchar(255) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Records of students
-- ----------------------------
INSERT INTO "public"."students" VALUES ('2020', 'nana', '女', '123456', '软件工程', '计算机科学与工程', '2020', '1', '软件201');
INSERT INTO "public"."students" VALUES ('2021', 'nuonuo', '男', '123456', '软件工程', '计算机科学与工程', '2020', '2', '环设201');
INSERT INTO "public"."students" VALUES ('2022', 'Seeluna', '女', '123456', '软件工程', '计算机科学与工程', '2020', '1', '国商201');
INSERT INTO "public"."students" VALUES ('2023', 'Na Lu', '男', '123456', '自动化', '机电工程', '2021', '1', '自动201');
INSERT INTO "public"."students" VALUES ('2025', 'seesee', '女', '123456', '软件工程', '计算机科学与工程', '2021', '1', '软件202');
INSERT INTO "public"."students" VALUES ('2024', '123', '男', '123456', '软件工程', '计算机科学与工程', '2018', '1', '123');

-- ----------------------------
-- Table structure for test_results
-- ----------------------------
DROP TABLE IF EXISTS "public"."test_results";
CREATE TABLE "public"."test_results" (
  "s_id" varchar COLLATE "pg_catalog"."default" NOT NULL,
  "test_result" varchar COLLATE "pg_catalog"."default",
  "test_time" varchar COLLATE "pg_catalog"."default" NOT NULL,
  "answerlist" varchar(255) COLLATE "pg_catalog"."default"
)
;

-- ----------------------------
-- Records of test_results
-- ----------------------------
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-06 20:39:57', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-06 20:41:48', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-06 21:26:50', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-06 21:27:31', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-06 21:29:13', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-06 21:29:30', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-06 21:34:01', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-06 21:38:08', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-06 21:38:33', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-06 21:39:12', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-06 21:56:05', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-06 21:58:23', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-06 21:58:33', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-06 21:58:56', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-06 21:59:40', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-06 22:15:39', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-06 22:16:01', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'ENTP', '2022-06-06 23:04:54', NULL);
INSERT INTO "public"."test_results" VALUES ('2021', 'INFP', '2022-06-07 00:58:06', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-06 23:05:17', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INTJ', '2022-06-06 18:04:49', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'ENTP', '2022-06-08 22:00:59', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'ENTP', '2022-06-08 22:33:47', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'ENTP', '2022-06-08 22:42:41', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'ENTP', '2022-06-08 22:43:01', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'ENTP', '2022-06-08 22:43:20', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'ENTP', '2022-06-08 23:36:08', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-06 21:34:48', NULL);
INSERT INTO "public"."test_results" VALUES ('2021', 'ENTP', '2022-06-08 22:34:18', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'ENTP', '2022-06-08 22:35:16', NULL);
INSERT INTO "public"."test_results" VALUES ('2021', 'ENTP', '2022-06-08 22:37:12', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'ENTP', '2022-06-08 22:37:32', NULL);
INSERT INTO "public"."test_results" VALUES ('2022', 'ENTP', '2022-06-08 23:36:59', NULL);
INSERT INTO "public"."test_results" VALUES ('2022', 'ENTP', '2022-06-08 23:56:17', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'ENTP', '2022-06-13 17:07:01', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'ENTP', '2022-06-13 17:07:48', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-13 17:53:48', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-14 01:47:36', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-14 01:49:54', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFP', '2022-06-13 17:57:00', NULL);
INSERT INTO "public"."test_results" VALUES ('2020', 'INFJ', '2022-06-14 17:33:14', 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');
INSERT INTO "public"."test_results" VALUES ('2020', 'INFJ', '2022-06-14 21:18:28', 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');

-- ----------------------------
-- Table structure for tests
-- ----------------------------
DROP TABLE IF EXISTS "public"."tests";
CREATE TABLE "public"."tests" (
  "TEST_NAME" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "TEST_TIME" varchar(255) COLLATE "pg_catalog"."default" NOT NULL
)
;

-- ----------------------------
-- Records of tests
-- ----------------------------

-- ----------------------------
-- Function structure for count_enfj
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."count_enfj"();
CREATE OR REPLACE FUNCTION "public"."count_enfj"()
  RETURNS "pg_catalog"."int4" AS $BODY$
	
	DECLARE
	counts int4;
	
	BEGIN
	-- Routine body goes here...
	select count(*) into counts from test_results
	where test_result = 'ENFJ';

	RETURN counts;
END$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for count_enfp
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."count_enfp"();
CREATE OR REPLACE FUNCTION "public"."count_enfp"()
  RETURNS "pg_catalog"."int4" AS $BODY$
	
	DECLARE
	counts int4;
	
	BEGIN
	-- Routine body goes here...
	select count(*) into counts from test_results
	where test_result = 'ENFP';

	RETURN counts;
END$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for count_entj
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."count_entj"();
CREATE OR REPLACE FUNCTION "public"."count_entj"()
  RETURNS "pg_catalog"."int4" AS $BODY$
	
	DECLARE
	counts int4;
	
	BEGIN
	-- Routine body goes here...
	select count(*) into counts from test_results
	where test_result = 'ENTJ';

	RETURN counts;
END$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for count_entp
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."count_entp"();
CREATE OR REPLACE FUNCTION "public"."count_entp"()
  RETURNS "pg_catalog"."int4" AS $BODY$
	
	DECLARE
	counts int4;
	
	BEGIN
	-- Routine body goes here...
	select count(*) into counts from test_results
	where test_result = 'ENTP';

	RETURN counts;
END$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for count_esfj
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."count_esfj"();
CREATE OR REPLACE FUNCTION "public"."count_esfj"()
  RETURNS "pg_catalog"."int4" AS $BODY$
	
	DECLARE
	counts int4;
	
	BEGIN
	-- Routine body goes here...
	select count(*) into counts from test_results
	where test_result = 'ESFJ';

	RETURN counts;
END$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for count_esfp
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."count_esfp"();
CREATE OR REPLACE FUNCTION "public"."count_esfp"()
  RETURNS "pg_catalog"."int4" AS $BODY$
	
	DECLARE
	counts int4;
	
	BEGIN
	-- Routine body goes here...
	select count(*) into counts from test_results
	where test_result = 'ESFP';

	RETURN counts;
END$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for count_estj
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."count_estj"();
CREATE OR REPLACE FUNCTION "public"."count_estj"()
  RETURNS "pg_catalog"."int4" AS $BODY$
	
	DECLARE
	counts int4;
	
	BEGIN
	-- Routine body goes here...
	select count(*) into counts from test_results
	where test_result = 'ESTJ';

	RETURN counts;
END$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for count_estp
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."count_estp"();
CREATE OR REPLACE FUNCTION "public"."count_estp"()
  RETURNS "pg_catalog"."int4" AS $BODY$
	
	DECLARE
	counts int4;
	
	BEGIN
	-- Routine body goes here...
	select count(*) into counts from test_results
	where test_result = 'ESTP';

	RETURN counts;
END$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for count_infj
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."count_infj"();
CREATE OR REPLACE FUNCTION "public"."count_infj"()
  RETURNS "pg_catalog"."int4" AS $BODY$
	
	DECLARE
	counts int4;
	
	BEGIN
	-- Routine body goes here...
	select count(*) into counts from test_results
	where test_result = 'INFJ';

	RETURN counts;
END$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for count_infp
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."count_infp"();
CREATE OR REPLACE FUNCTION "public"."count_infp"()
  RETURNS "pg_catalog"."int4" AS $BODY$
	
	DECLARE
	counts int4;
	
	BEGIN
	-- Routine body goes here...
	select count(*) into counts from test_results
	where test_result = 'INFP';

	RETURN counts;
END$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for count_intj
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."count_intj"();
CREATE OR REPLACE FUNCTION "public"."count_intj"()
  RETURNS "pg_catalog"."int4" AS $BODY$
	
	DECLARE
	counts int4;
	
	BEGIN
	-- Routine body goes here...
	select count(*) into counts from test_results
	where test_result = 'INTJ';

	RETURN counts;
END$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for count_intp
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."count_intp"();
CREATE OR REPLACE FUNCTION "public"."count_intp"()
  RETURNS "pg_catalog"."int4" AS $BODY$
	
	DECLARE
	counts int4;
	
	BEGIN
	-- Routine body goes here...
	select count(*) into counts from test_results
	where test_result = 'INTP';

	RETURN counts;
END$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for count_isfj
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."count_isfj"();
CREATE OR REPLACE FUNCTION "public"."count_isfj"()
  RETURNS "pg_catalog"."int4" AS $BODY$
	
	DECLARE
	counts int4;
	
	BEGIN
	-- Routine body goes here...
	select count(*) into counts from test_results
	where test_result = 'ISFJ';

	RETURN counts;
END$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for count_isfp
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."count_isfp"();
CREATE OR REPLACE FUNCTION "public"."count_isfp"()
  RETURNS "pg_catalog"."int4" AS $BODY$
	
	DECLARE
	counts int4;
	
	BEGIN
	-- Routine body goes here...
	select count(*) into counts from test_results
	where test_result = 'ISFP';

	RETURN counts;
END$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for count_istj
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."count_istj"();
CREATE OR REPLACE FUNCTION "public"."count_istj"()
  RETURNS "pg_catalog"."int4" AS $BODY$
	
	DECLARE
	counts int4;
	
	BEGIN
	-- Routine body goes here...
	select count(*) into counts from test_results
	where test_result = 'ISTJ';

	RETURN counts;
END$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for count_istp
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."count_istp"();
CREATE OR REPLACE FUNCTION "public"."count_istp"()
  RETURNS "pg_catalog"."int4" AS $BODY$
	
	DECLARE
	counts int4;
	
	BEGIN
	-- Routine body goes here...
	select count(*) into counts from test_results
	where test_result = 'ISTP';

	RETURN counts;
END$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for delete_college
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."delete_college"();
CREATE OR REPLACE FUNCTION "public"."delete_college"()
  RETURNS "pg_catalog"."trigger" AS $BODY$BEGIN
	-- Routine body goes here...
	delete from majors where college_name = old.college_name;

	RETURN old;
END$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for delete_major
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."delete_major"();
CREATE OR REPLACE FUNCTION "public"."delete_major"()
  RETURNS "pg_catalog"."trigger" AS $BODY$BEGIN
	delete from classes where major_name = old.major_name;
	-- Routine body goes here...

	RETURN old;
END$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Function structure for delete_stu
-- ----------------------------
DROP FUNCTION IF EXISTS "public"."delete_stu"();
CREATE OR REPLACE FUNCTION "public"."delete_stu"()
  RETURNS "pg_catalog"."trigger" AS $BODY$BEGIN
	-- Routine body goes here...
	delete from test_results where s_id = old.s_id;
	return old;

END$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

-- ----------------------------
-- Primary Key structure for table classes
-- ----------------------------
ALTER TABLE "public"."classes" ADD CONSTRAINT "Classes_pkey" PRIMARY KEY ("class_name");

-- ----------------------------
-- Triggers structure for table colleges
-- ----------------------------
CREATE TRIGGER "delete_col_trigger" AFTER DELETE ON "public"."colleges"
FOR EACH ROW
EXECUTE PROCEDURE "public"."delete_college"();

-- ----------------------------
-- Primary Key structure for table colleges
-- ----------------------------
ALTER TABLE "public"."colleges" ADD CONSTRAINT "Colleges_pkey" PRIMARY KEY ("coid", "college_name");

-- ----------------------------
-- Primary Key structure for table grades
-- ----------------------------
ALTER TABLE "public"."grades" ADD CONSTRAINT "Grade_pkey" PRIMARY KEY ("grade");

-- ----------------------------
-- Triggers structure for table majors
-- ----------------------------
CREATE TRIGGER "delete_maj_trigger" AFTER DELETE ON "public"."majors"
FOR EACH ROW
EXECUTE PROCEDURE "public"."delete_major"();

-- ----------------------------
-- Primary Key structure for table majors
-- ----------------------------
ALTER TABLE "public"."majors" ADD CONSTRAINT "Major_pkey" PRIMARY KEY ("major_name");

-- ----------------------------
-- Primary Key structure for table personalities
-- ----------------------------
ALTER TABLE "public"."personalities" ADD CONSTRAINT "Personality_pkey" PRIMARY KEY ("PersonalityName", "Alias");

-- ----------------------------
-- Primary Key structure for table questions
-- ----------------------------
ALTER TABLE "public"."questions" ADD CONSTRAINT "Question_pkey" PRIMARY KEY ("question", "num");

-- ----------------------------
-- Triggers structure for table students
-- ----------------------------
CREATE TRIGGER "delete_stu_trigger" AFTER DELETE ON "public"."students"
FOR EACH ROW
EXECUTE PROCEDURE "public"."delete_stu"();

-- ----------------------------
-- Primary Key structure for table students
-- ----------------------------
ALTER TABLE "public"."students" ADD CONSTRAINT "students_pkey" PRIMARY KEY ("s_id");

-- ----------------------------
-- Primary Key structure for table test_results
-- ----------------------------
ALTER TABLE "public"."test_results" ADD CONSTRAINT "Test_result_pkey" PRIMARY KEY ("test_time");

-- ----------------------------
-- Primary Key structure for table tests
-- ----------------------------
ALTER TABLE "public"."tests" ADD CONSTRAINT "Tests_pkey" PRIMARY KEY ("TEST_NAME");
